package com.es.www.simpleFactory;

import java.util.Objects;

/**
 * @Created by michangtao
 * @Date 2022/5/11 15:47
 * @Description
 */
public class SimpleFactory {

    public static Pizza createPizza(String pizzaType){
        Pizza pizza = null;
        if (Objects.equals(pizzaType, "greek")) {
            pizza = new GreekPizza();
            pizza.setName("希腊披萨");
        }
        else if (Objects.equals(pizzaType, "cheese")) {
            pizza = new CheesePizza();
            pizza.setName("芝士披萨");
        }
        return pizza;
    }
}
